package com.lagou.rpc.consumer.proxy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.reflect.Proxy;

@Component
public class RemoteServiceProxyFactory {
    @Autowired
    private RemoteServiceInvocationHandler  invocationHandler;

    public Object createProxy(Class service){

        return Proxy.newProxyInstance(service.getClassLoader(), new Class[]{service}, invocationHandler);
    }
}
